<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 200px;
        }
    </style>
</head>
<body>
    <button id="lry">刘若英</button>
    <button id="dlhc">张学友</button>
    <img src="../images/b06.jpg" alt="">

    <script>
        //1.修改属性src属性
        var lry = document.getElementById('lry');
        var dlhc = document.getElementById('dlhc');
        var bgImage = document.querySelector('img');
        //绑定点击事件
        lry.onclick = function() {
            bgImage.src = "../images/b06.jpg";
            this.style.backgroundColor = 'pink';
            dlhc.style.backgroundColor = '';
        }

        dlhc.onclick = function() {
            bgImage.src = "../images/b07.jpg";
            this.style.backgroundColor = 'pink';
            lry.style.backgroundColor = '';
        }
    </script>
</body>
</html>